<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>用户资金列表</title>
    <link rel="stylesheet" type="text/css" th:href="@{/js/layui/css/layui.css}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/style.css/}" media="all">
    <link rel="stylesheet" type="text/css" th:href="@{/css/fyn/my.css/}" media="all">
    <style>
        /*.layui-table-cell{*/
            /*display:table-cell;*/
            /*vertical-align: middle;*/
        /*}*/
        /*.fr .layui-input-inline{*/
            /*margin-right: 20px;*/
            /*margin-bottom: 10px;*/
        /*}*/
    </style>
</head>
<body style="padding-top: 20px">
<div class="layui-fluid">
    <div class="layui-card">
        <div class="my-btn-box layui-form">
            <span class="fr">
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" name="id" placeholder="用户ID" class="layui-input height33">
                </div>
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" name="name" placeholder="用户昵称" class="layui-input height33">
                </div>
                <div class="layui-input-inline">
                    <input type="text" autocomplete="off" name="mobile" placeholder="手机号" class="layui-input height33">
                </div>
                <button class="layui-btn layui-btn-sm" id="search"><i class="layui-icon">&#xe615;</i>搜索</button>
            </span>
        </div>
        <div class="layui-card-body">
            <div id="dateTable" lay-filter="event"></div>
            <div class="height50"></div>
        </div>
    </div>
</div>


<script th:src="@{/js/layui/layui.js}"></script>
<script th:src="@{/js/fyn/index.js}"></script>
<script th:src="@{/js/fyn/my.js}"></script>
<script type="text/javascript" th:src="@{/js/vip/vip_comm.js}"></script>
<script type="text/javascript" th:src="@{/js/vip/vip_table.js}"></script>
<script type="text/javascript" th:inline="javascript">

    // layui方法
    layui.use(['table', 'form', 'element', 'laypage', 'layer'], function () {
        // 操作对象
        var form = layui.form
            , table = layui.table
            , layer = layui.layer
            , $ = layui.jquery;

        // 表格渲染
        var tableIns = table.render({
            elem: '#dateTable'                  //指定原始表格元素选择器（推荐id选择器）
            , height: "full"    //容器高度
            , even: 'true'
            , cols: [[                  //标题栏
                {field: 'id', title: 'ID', minWidth: '100', sort: true, align: 'center'}
                ,{field: 'nick', title: '昵称', minWidth: '100', align: 'center'}
                , {field: 'mobile', title: '手机号', minWidth: '100', align: 'center'}
                , {field: 'avatar', title: '用户头像', minWidth: '50', align: 'center', templet: function (d) {
                        var avatar = d.avatar == null ? '' : d.avatar;
                        return "<a style='margin-left: 5px;' onclick='showUserDetails("+d.id+")'><img src='" + avatar + "' width='40' height='40'  /></a>";
                    }
                }
                , {field: 'realName', title: '真实姓名',minWidth: '100', align: 'center'}
                , {field: 'idNumber', title: '身份证号', minWidth: '200', align: 'center'}
                , {field: 'appid', title: '应用ID', minWidth: '100', align: 'center'}
                , {field: 'banlance', title: '余额',minWidth: '20', align: 'center'}
                , {field: 'remark', title: '备注', minWidth: '100', align: 'center'}
                , {title: '操作', align: 'center', minWidth: '50', toolbar: '#barOption'}
            ]]
            , id: 'dataCheck'
            , url: [[${basePath}]] + '/member/memberFundsList'
            , method: 'get'
            , page: true
            , limits: [10, 30, 60, 90, 150, 300]
            , toolbar: '#topOperate'
            , limit: 10 //默认采用0
            , loading: true
            // , where: getJson()
            , done: function (res, curr, count) {
            }
        });

        //头工具栏事件
        table.on('tool(event)', function (obj) {
            var data = obj.data;
            // 用户资金明细
            if (obj.event === 'fundDetails') {
                layer.open({
                    type: 2,
                    title: '资金明细',
                    shadeClose: true,
                    shade: 0.2,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['100%', '100%'],
                    content: [[${basePath}]] + '/member/fundDetails?userId=' + data.id
                });
            }
        });
        var status = 0;
        form.on('switch(status)', function (data) {
            if (!data.elem.checked) {
                status = 1;
            } else {
                status = 0;
            }
            $("#search").click();
        });

        var validStatus = null;
        form.on('select(validStatus)', function (data) {
            validStatus = (data.value); //得到被选中的值
        });

        function getJson() {
            return {
                where: {
                    name: $("input[name='name']").val()
                    ,userId: $("input[name='id']").val()
                    ,mobile: $("input[name='mobile']").val()
                }
            };
        }

        $("#search").click(function () {
            tableIns.reload({
                where: {
                    name: $("input[name='name']").val()
                    ,userId: $("input[name='id']").val()
                    ,mobile: $("input[name='mobile']").val()
                },
                page: {
                    curr: 1
                }
            });
        });
    });
</script>
<!-- 表格操作按钮集 -->
<script type="text/html" id="barOption">
    <a class="layui-btn layui-btn-xs" lay-event="fundDetails"><i class="layui-icon layui-icon-password"></i>资金明细</a>
</script>
</body>
</html>